import api from '@/request/question'
import { ref } from 'vue'
const upDateTable = async (params, tableData) => {
	tableData.value = await api.getTableData(params)
}
const changeFile = (file, showImportRef) => {
	api.uploadFile(file, content => {
		showImportRef.tableData = JSON.parse(content)
		showImportRef.value = false
	})
}
const importFile = ({ content }, showImportRef) => {
	api.importFile({ content }, result => {
		if (content) {
			showImportRef.tableData = []
		}
	}) 
}
export default {
	getTableData: api.getTableData,
	upDateTable,
	changeFile,
	importFile
}